unit SelectTable;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Edit, RzPanel, ExtCtrls, RzDlgBtn, StdCtrls, Mask, RzEdit;

type
  TSelectTableFrm = class(TEditFrm)
    Label1: TLabel;
    ComboBox1: TComboBox;
    RzNumericEdit1: TRzNumericEdit;
    Label2: TLabel;
    Label3: TLabel;
    RzNumericEdit2: TRzNumericEdit;
    procedure RzDialogButtons1ClickOk(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  SelectTableFrm: TSelectTableFrm;

implementation

uses DM;

{$R *.dfm}

procedure TSelectTableFrm.RzDialogButtons1ClickOk(Sender: TObject);
begin
  inherited;
  if (ComboBox1.ItemIndex = 0) then
  begin
    dmMain.tblOne.Close;
    dmMain.tblOne.TableName := 'OneMeter';
    dmMain.tblOne.Filter := 'HFen>= ' + RzNumericEdit1.Text + '  And HFen <= ' + RzNumericEdit2.Text;
    dmMain.tblOne.Open;
    dmMain.tblOne.Filtered := True;
  end;

  if (ComboBox1.ItemIndex = 1) then
  begin
    dmMain.tblOne.Close;
    dmMain.tblOne.TableName := 'TwoMeter';
    dmMain.tblOne.Filter := 'HFen>= ' + RzNumericEdit1.Text + '  And HFen <= ' + RzNumericEdit2.Text;
    dmMain.tblOne.Open;
    dmMain.tblOne.Filtered := True;
  end;

  if (ComboBox1.ItemIndex = 2) then
  begin
    dmMain.tblOne.Close;
    dmMain.tblOne.TableName := 'AvgMeter';
    dmMain.tblOne.Filter := 'HFen>= ' + RzNumericEdit1.Text + '  And HFen <= ' + RzNumericEdit2.Text;
    dmMain.tblOne.Open;
    dmMain.tblOne.Filtered := True;
  end;

end;

end.
